package Huihu.src.cnitcast;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

//服务端
public class Server {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket=new ServerSocket(9875);
        Socket socket=serverSocket.accept();
        InputStream is=socket.getInputStream();
        FileOutputStream os=new FileOutputStream("Libs/f.jpg");
        byte [] bus=new byte[1024];
        int len;
        while ((len = is.read(bus)) != -1) {
            os.write(bus,0,len);
        }
        os.close();
        is.close();
        socket.close();
        serverSocket.close();
    }
}
